import Service from '@ember/service';

export default class MessageService extends Service {
  
  showMsg(msg) {
    // 创建一个自定义事件，并传递消息
    const customEvent = new CustomEvent('showMessage', {
      detail: {
        type: "check",
        message: msg
      }
    });

    // 触发自定义事件
    document.body.dispatchEvent(customEvent);
  }

  showErrMsg(msg) {
    // 创建一个自定义事件，并传递消息
    const customEvent = new CustomEvent('showMessage', {
      detail: {
        type: "error",
        message: msg
      }
    });

    // 触发自定义事件
    document.body.dispatchEvent(customEvent);
  }
}